class Solution:
    def maxLength(self,arr):
        dict = {}
        res = 0
        start = -1
        for end in range(len(arr)):
            if arr[end] in dict:
                start = max(start, dict[arr[end]])
            dict[arr[end]] = end
            # res用来记录当前的最大值啊
            res = max(res, end - start)
        return res